#!/usr/bin/perl

print STDERR "Loading $ARGV[0]\n";
open(FILE,$ARGV[0]);
$id = 1;
while($line=<FILE>) {
	chomp($line);
	$line=~s/\s*//g;
	$line = lc($line);
	$corpusIDs{$line} = $id;
	$id++;
}
close(FILE);
print STDERR "Loaded\n";

my(%foundIDs);
while($line=<STDIN>) {
	chomp($line);
	$line=~s/\s*//g;
	$line=lc($line);
	$foundIDs{$corpusIDs{$line}} = 1;
}

foreach $id (sort {$a<=>$b} keys %foundIDs) {
	print $id."\n";
}
